/*
 * PlayerData.h
 *
 *  Created on: Aug 26, 2019
 *      Author: warrock
 */

#ifndef PlayerData_H_
#define PlayerData_H_

#include <thread>
#include <queue>
#include <string>

using namespace std;

typedef enum{
	E_CONNECTING = 0x01,
	E_WATTING_IN_GAME_ROOM,
}t_ClientStaus;

class PlayerData {
public:
	PlayerData(int fd);
	virtual ~PlayerData();
	int SendDataToPlayer(string data);
	string GetOneDataFromPlayer();
	int PutDataInPlayer(string data);
	int IsDataEmpty();
	void Disconnect();
private:
	string OutputAllStrFromQueue(queue<string> &q1);
	void EmptyQueue(queue<string> &q1);
public:
	t_ClientStaus client_staus;
private:
	pthread_mutex_t mutex;
	queue<string> data_que;
	int player_fd;
};

#endif /* PlayerData_H_ */
